//
//  HRInterfaceManager.h
//  haierapp
//
//  Created by Xia Zhiyong on 14-8-21.
//  Copyright (c) 2014年 haier. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "HRResultModel.h"


typedef void (^interfaceManagerBlock)(BOOL isSucceed, NSString *message, id data);

typedef enum{
    TYPE_PRODUCT_LIST_BY_SEARCH,    //根据关键字
    TYPE_PRODUCT_LIST_BY_ID //根据分类ID
} TYPE_PRODUCT_LIST;

typedef enum{
    ORDER_TYPE_PRODUCT_LIST_TIME=0, //按时间排序
    ORDER_TYPE_PRODUCT_LIST_SALES,  //按销量排序
    ORDER_TYPE_PRODUCT_LIST_PRAISE  //按好评排序
    
}ORDER_TYPE_PRODUCT_LIST;

typedef enum{
    ORDER_APPLY_TYPE_REPAIR = 1,    //维修
    ORDER_APPLY_TYPE_CHANGE,    //换货
    ORDER_APPLY_TYPE_RETURN //退货

} ORDER_APPLY_TYPE;

typedef enum{
    ORDER_APPLY_ADDR_TYPE_ORIGIN,   //原有地址
    ORDER_APPLY_ADDR_TYPE_NEW   //新地址

} ORDER_APPLY_ADDR_TYPE;



//接口action名称

//购物车列表
static NSString *const API_SHOP_CAR_LIST = @"getProductListByUid";

//商品分类
static NSString *const API_CATEGORY_LIST = @"getProCategoryList";

//用户登录
static NSString *const API_USER_LOGIN = @"login";

//用户注册
static NSString *const API_USER_REGISTER = @"userRegister";

//用户注册激活
static NSString *const API_USER_REGISTER_ACTIVITY = @"userActivate";

//用户注册重新发送激活码
static NSString *const API_USER_REGISTER_ACTIVITY_CODE = @"userActivationCode";

//添加收获地址
static NSString *const API_ADD_ADDRESS = @"addReceiveAddress";

//删除收获地址
static NSString *const API_DEL_ADDRESS = @"deleteReceiveAddressById";

//更新收获地址
static NSString *const API_UPDATE_ADDRESS = @"updateReceiveAddress";

//设置默认地址
static NSString *const API_SET_DEFAULT_ADDRESS = @"setDefaultAddress";

// 获取所有收获地址
static NSString *const API_ALL_ADDRESS = @"getReceiveAddressList";

//添加收藏商品
static NSString *const API_ADD_FAV = @"saveFavorite";

//删除收藏商品
static NSString *const API_DEL_FAV = @"deleteFavorite";

//获取收藏的商品
static NSString *const API_GET_FAV = @"getFavoriteListByUid";

//增加购物车中的商品数量
static NSString *const API_SHOPCART_COUNT = @"editShopCartCount";

//添加商品到购物车
static NSString *const API_SHOPCART_ADD_PRODUCT = @"addShopCart";


//从购物车删除商品
static NSString *const API_DEL_AUSC = @"deleteAllSc";

//获取分类商品列表信息
static NSString *const API_PRODUCT_LIST_BY_CATEGORY = @"getProductListByClassification";

//根据搜索条件获取商品列表信息
static NSString *const API_PRODUCT_LIST_BY_SEARCH = @"getProductSearch";

//根据商品ID获取商品信息
static NSString *const API_PRODUCT_INFO_BY_ID = @"getProductInfo";

//根据商品ID列表获取商品信息
static NSString *const API_PRODUCT_LIST_BY_IDLIST = @"getProductInfoByIds";

//获取指定商品的评价信息
static NSString *const API_PRODUCT_EVALUATE_BY_ID = @"getProductEvaluate";

//评价订单商品
static NSString *const API_EVALUATE_ORDER_PRODUCTS = @"orderEvaluate";

//获取所有省
static NSString *const API_GET_PROVINCE = @"getProvinceList";

//获取省下的市
static NSString *const API_GET_CITY = @"getCityList";

//获取市下的区
static NSString *const API_GET_COUNTY = @"getCountyList";

//优惠券
static NSString *const API_COUPON_LIST = @"getCouponList";

//订单跟踪（订单进度查询）
static NSString *const API_ORDER_TRACKING = @"getOrderTracking";


//创建新订单
static NSString *const API_CREATE_ORDER = @"createOrder";

//获取所有订单
static NSString *const API_GET_ORDERS = @"getOrderList";

//订单详情
static NSString *const API_ORDER_DEATAIL = @"getOrderDetails";

//取消订单
static NSString *const API_ORDER_CANCEL = @"cancelOrder";

//获取积分信息
static NSString *const API_GET_POINTS = @"getTotalPointsById";

//获取产品列表
static NSString *const API_PRODUCT_LIST = @"getProductListByOrder";

//确认收货
static NSString *const API_ORDER_RECEIPT = @"updateOrderState";

//售后申请
static NSString *const API_ORDER_REPAIR_APPLY = @"repairOrderApply";

//售后详情
static NSString *const API_ORDER_REPAIR_DETAILS = @"repairOrderDetails";

//获取售后申请订单列表
static NSString *const API_GET_APPLY_ORDER_LIST = @"repairOrderList";

//获取积分详情
static NSString *const API_GET_POIGTS_LIST = @"selectPointsItemsById";

//新增支付单
static NSString *const API_PAY_BILL = @"savePayBill";

//更改订单状态
static NSString *const API_UPDATE_ORDER_STATE = @"updateOrderPayState";

//校验商品库存
static NSString *const API_CHECK_STOCK = @"checkStock";

@interface HRInterfaceManager : NSObject

+ (void)succeedWithResult:(HRResultModel *)result
                  message:(NSString *)message
                 callback:(interfaceManagerBlock)completion;

+ (void)failedWithError:(NSError *)error
                message:(NSString *)message
               callback:(interfaceManagerBlock)completion;

//获取购物车商品列表
+(void)getProductListByUid:(NSString*)uid completion:(interfaceManagerBlock)completion;

//获取商品分类

+(void)getProCategoryList:(interfaceManagerBlock)completion;

//用户登录
+(void)loginWithUserName:(NSString *)userName withPassword:(NSString *)password completion:(interfaceManagerBlock)completion;

//用户注册
+(void)registerWithUserName:(NSString *)userName withPassword:(NSString *)password withMobile:(NSString *)mobile completion:(interfaceManagerBlock)completion;

//用户注册激活
+(void)registerActivityWithUserName:(NSString *)userName withActivityCode:(NSString *)code completion:(interfaceManagerBlock)completion;

//重新发送用户注册的激活号码
+(void)activityCodeInRegisterWithUserName:(NSString *)userName withMobile:(NSString *)mobile completion:(interfaceManagerBlock)completion;

//添加收获地址
+(void)addReceiveAddress:(NSString*)consignee phone:(NSString*)phone telephone:(NSString*)telephone zipcode:(NSString*)zipcode email:(NSString*)email provinceCode:(NSString*)provinceCode provinceName:(NSString*)provinceName cityCode:(NSString*)cityCode cityName:(NSString*)cityName sectionCode:(NSString*)sectionCode sectionName:(NSString*)sectionName addressDetail:(NSString*)addressDetail addressShort:(NSString*)addressShort completion:(interfaceManagerBlock)completion;

//删除收获地址
+(void)deleteReceiveAddressById:(NSString*)receiveAddressId completion:(interfaceManagerBlock)completion;

//更新收获地址
+(void)updateReceiveAddress:(NSString*)consignee receiveAddressId:(NSString*)receiveAddressId phone:(NSString*)phone telephone:(NSString*)telephone zipcode:(NSString*)zipcode email:(NSString*)email provinceCode:(NSString*)provinceCode provinceName:(NSString*)provinceName cityCode:(NSString*)cityCode cityName:(NSString*)cityName sectionCode:(NSString*)sectionCode sectionName:(NSString*)sectionName addressDetail:(NSString*)addressDetail addressShort:(NSString*)addressShort completion:(interfaceManagerBlock)completion;

//设置默认地址
+(void)setDefaultAddress:(NSString*)receiveAddressId completion:(interfaceManagerBlock)completion;

//获取所有收获地址
+(void)getReceiveAddressList:(interfaceManagerBlock)completion;

//添加收藏
+(void)addFavorite:(NSString *)productId completion:(interfaceManagerBlock)completion;

//删除收藏
+(void)deleteFavorite:(NSString*)productId completion:(interfaceManagerBlock)completion;

//获取收藏
+(void)getFavoriteListByUid:(interfaceManagerBlock)completion;

//编辑购物车商品数量
+(void)editShopCarCount:(int)type productId:(NSString*)productId nowGoodsAmount:(int)amount completion:(interfaceManagerBlock)completion;


//添加商品到购物车
+(void)addProductToShopCar:(NSString *)productId completion:(interfaceManagerBlock)completion;

//从购物车中删除商品
+(void)deleteAllSc:(NSString *)productId completion:(interfaceManagerBlock)completion;


//分类获取商品列表信息
+(void)getProductListByCategoryId:(NSString *)categoryId withPageSize:(int)pageSize withPageNumber:(int)pageNum completion:(interfaceManagerBlock)completion;


//搜索条件获取商品列表信息
+(void)getProductListBySearch:(NSString *)searchContent withPageSize:(int)pageSize withPageNumber:(int)pageNum completion:(interfaceManagerBlock)completion;

//获取指定的商品信息
+(void)getProductById:(NSString *)productId completion:(interfaceManagerBlock)completion;

//获取商品列表信息通过商品ID列表
+(void)getProductListByIDList:(NSString *)productIdList completion:(interfaceManagerBlock)completion;

//获取指定商品的评价信息
+(void)getEvaluateByProductId:(NSString *)productId withPageSize:(int)pageSize withPageNumber:(int)pageNum completion:(interfaceManagerBlock)completion;

//获取所有省
+(void)getProvinceList:(interfaceManagerBlock)completion;

//获取省下的市
+(void)getCityList:(NSString*)Code completion:(interfaceManagerBlock)completion;

//获取市下的区
+(void)getCountyList:(NSString*)Code completion:(interfaceManagerBlock)completion;

//获取优惠券列表
+(void)getCouponList:(interfaceManagerBlock)completion;


//查看订单进度（订单跟踪）
+(void)getOrderTrackingById:(NSString *)orderId completion:(interfaceManagerBlock)completion;


//创建新订单
+(void)createOrder:(NSString*)addressId paymentMethod:(NSString*)paymentMethod distributionTime:(int)distributionTime invoiceType:(int)invoiceType invoiceName:(NSString*)invoiceName isCoupon:(int)isCoupon couponsId:(NSString*)couponsId remark:(NSString*)remark distributionType:(int)distributionType productList:(NSArray*)productList isActivity:(int)isActivity activityId:(NSString *)activityId completion:(interfaceManagerBlock)completion;


//获取所有订单
+(void)getOrderListWithCompletion:(interfaceManagerBlock)completion;

//订单详情
+(void)getOrderDetails:(NSString*)orderNo completion:(interfaceManagerBlock)completion;

//取消订单
+(void)cancelOrderById:(NSString *)orderId andReason:(NSString *)reason completion:(interfaceManagerBlock)completion;

//获取产品列表
+(void)getProductListByType:(TYPE_PRODUCT_LIST)type withContent:(NSString *)content withPageSize:(NSString *)pageSize withPageNumber:(NSString *)pageNum withOrderType:(ORDER_TYPE_PRODUCT_LIST)orderType withOrderBy:(int)order completion:(interfaceManagerBlock)completion;

//确认收货
+(void)receiptOrder:(NSString *)orderId completion:(interfaceManagerBlock)completion;

//申请售后
+(void)repairOrderApplyByOrder:(NSString *)orderId withReason:(NSString *)reason withType:(ORDER_APPLY_TYPE)type withAddrType:(ORDER_APPLY_ADDR_TYPE)addrType withProductId:(NSString *)productId withProductCount:(NSString *)productCount completion:(interfaceManagerBlock)completion;

//查看售后详情
+(void)getOrderApplyDetailById:(NSString *)serviceNo completion:(interfaceManagerBlock)completion;

//获取售后订单列表
+(void)getOrderListApply:(interfaceManagerBlock) completion;

//获取积分信息
+(void)getTotalPointsById:(interfaceManagerBlock)completion;

//获取积分列表
+(void)selectPointsItemsById:(interfaceManagerBlock)completion;

//新增支付单
+(void)savePayBill:(NSString*)orderIdList payMoney:(NSString*)payMoney paymentNo:(NSString*)paymentNo completion:(interfaceManagerBlock)completion;

//更改订单状态
+(void)updateOrderPayState:(NSString*)payNo message:(NSString*)message completion:(interfaceManagerBlock)completion;

//校验商品库存
+(void)checkStockByProductId:(NSArray *)productList withSectionCode:(NSString *)code completion:(interfaceManagerBlock)completion;

//评价订单商品
+(void)evaluateOrderProducts:(NSArray *)productList completion:(interfaceManagerBlock)completion;

@end
